package com.slz3.business.module.configManagement.conSiteCounty.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conSiteCounty.domain.ConSiteCounty;
import com.slz3.business.module.configManagement.conSiteCounty.domain.ConSiteCountyFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConSiteCountyTransactionalServiceImpl implements ConSiteCountyTransactionalService {

    @Override
    public ConSiteCounty modify(ConSiteCounty conSiteCountyNew) {
        Repositorys.conSiteCounty.test();
        Repositorys.conSiteCounty.save(ConSiteCountyFactory.initBaseFields());
        System.err.println(1/0);
        conSiteCountyNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conSiteCounty.saveAndFlush(conSiteCountyNew);
    }

    @Override
    public List<ConSiteCounty> batchModify(List<ConSiteCounty> conSiteCountyList) {
        return Repositorys.conSiteCounty.saveAll(conSiteCountyList);
    }
}
